<!-- ak-app-main/src/App.vue -->
<template>
  <div class="full">
    <div v-show="!$route.meta.withoutLayout">
      <div class="header">
        <ul class="nav">
          <li><span style="font-family:Comic Sans MS;font-size:14px;">
              <div class="menu-icon" @click="clickMenu"></div>
            </span>
          </li>
        </ul>
      </div>
      <div class="dasmaI" :class="isActive?'':'no_active'">
        <div class="scl" :class="isActive?'':'no_active'">
          <ul class="nav">
            <li style="padding: 15px 0;" @click="isActive=false" v-for="item in menuList" :key="item.key">
              <router-link :to="{path: item.path }">
                <span>{{item.name}}</span>
              </router-link>
            </li>
          </ul>
        </div>
        <div class="bfmk" @click="isActive = false" :class="isActive?'':'no_active'"></div>
      </div>
    </div>
    <div class="container">
      <router-view v-show="$route.name" />
      <section v-show="!$route.name" id="frame"></section>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      menuList: [
        {
          name: '主应用-1',
          key: '1',
          path: '/home'
        },
        {
          name: '主应用-1-2',
          key: '4',
          path: '/childs'
        },
        {
          key: '2',
          name: '子应用-1',
          path: '/vue'
        },
        {
          key: '3',
          name: '子应用-1-2',
          path: '/vue/about'
        }
      ],
      isActive: false
    }
  },
  created() {
    console.log(this.$route.name)
  },
  methods: {
    clickMenu() {
      this.isActive = !this.isActive
    }
  }
}
</script>


<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  height: 100%;
  font-family: 微软雅黑;
  color: rgb(75, 75, 75);
}

html,
body,
.full {
  height: 100%;
  width: 100%;
  text-align: center;
}
* {
  margin: 0;
  padding: 0;
}
.menu-icon {
  display: inline-block;
  width: 30px;
  height: 3px;
  padding: 5px 0;
  border-top: 3px solid;
  border-bottom: 3px solid;
  background-color: currentColor;
  background-clip: content-box;
}
.dasmaI {
  display: flex;
  position: fixed;
  top: 53px;
  right: 0px;
  bottom: 0px;
  left: 0px;
  z-index: 998;
  &.no_active {
    width: 0px;
    overflow: hidden;
  }
  .scl {
    position: relative;
    z-index: 10;
    box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 4px 0px;
    background-color: rgb(255, 255, 255);
    width: 240px;
    height: 100%;
    transition: all 0.25s ease-in-out 0s;
    &.no_active {
      transform: translateX(-100%);
    }
  }
  .bfmk {
    position: absolute;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.2);
    width: 100vw;
    height: 100vh;
    transition: opacity 0.25s ease-in-out 0s;
    visibility: visible;
    opacity: 1;
    &.no_active {
      visibility: hidden;
      opacity: 0;
    }
  }
}
.header {
  background: #4d4d4d;
  .nav {
    color: #fff;
    padding: 15px;
    display: flex;

    li {
      margin: 0 10px;
      list-style: none;
      cursor: pointer;
    }
  }
}
.container {
  height: 100%;
  width: 100%;
  position: relative;
}
a {
  text-decoration: none;
  color: rgb(75, 75, 75);
}
</style>
